﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using LibNiconico.NiconicoApi.Internal;
using LibNiconico.NiconicoApi.Extentions;

namespace LibNiconico.NiconicoApi.Lives.Comments.Broadcast
{
    /// <summary>
    /// ニコニコ生放送配信APIレスポンス
    /// </summary>
    public sealed class NicoLiveBroadcastResponse
    {
        /// <summary>
        /// 結果ステータス
        /// </summary>
        public string Status { get; private set; }

        private NicoLiveBroadcastResponse(QueryStrings query)
        {
            Status = "";
        }

        /// <summary>
        /// 結果文字列を解析
        /// </summary>
        /// <param name="query"></param>
        /// <returns></returns>
        public static NicoLiveBroadcastResponse Parse(QueryStrings query)
        {
            NicoLiveBroadcastResponse res = new NicoLiveBroadcastResponse(query);
            res.Status = (from v in query
                          where v.Key == "status"
                          select v.Value).First() ?? "";

            return res;
        }
    }
}
